#!/bin/bash

shellPath=$(dirname $(readlink -f $0))
jarPath=$shellPath"/xxx.jar"
pidFile=$shellPath"/process.pid"

if [ -e $pidFile ] ; then
pid=`cat $pidFile`
pName=$(ps -ef | grep $pid| grep -v grep | awk 'NR==1 {print $NF}')
if [ "$jarPath" = "$pName" ]; then
kill -15 $pid
echo "process to be killed is $pid"
else
echo "The process id [$pid] does not match the process name [$pName]"
fi
else
echo "Unable to find file $pidFile"
fi